const { defineConfig } = require("@vue/cli-service");

module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: "./",
  productionSourceMap: process.env.NODE_ENV === "dev",
  css: {
    loaderOptions: {
      less: {
        lessOptions: {
          modifyVars: {
            "primary-color": "#1890ff",
            "font-size-base": "14px",
            "text-color": "#333",
          },
          javascriptEnabled: true,
        },
      },
    },
  },
  devServer: {
    host: '0.0.0.0',
    port: 8166,
    client: {
      webSocketURL: 'ws://0.0.0.0:8166/ws',
    },
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
    proxy: {
      '/api': {
        target: 'http://118.89.188.93:8081',
        changeOrigin: true, // 是否跨域
        pathRewrite: {
          '^/api': ''
        }
      },
    },
  },
  configureWebpack: {
    devtool: process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map',
    resolve: {
      // 设置路径别名
      alias: {
        'vue$': 'vue/dist/vue.esm.js'
      }
    }
  },
});
